
<table class="table">
<thead>
	<tr>
		<td class="col-sm-1">&nbsp;</td>
		<td class="col-sm-2">Account</td>
		<td class="col-sm-3">narration</td>
		<td class="col-sm-1">Debit</td>
		<td class="col-sm-1">Credit</td>
	</tr>
</thead>
<tbody>
	<?php $totalAmountDebit = 0; $totalAmountCredit = 0; ?>
	<?php foreach($modelCashReceiptJournalItem as $i=>$item): ?>
	<?php 	
			$totalAmountDebit += $item->amountDebit; 
			$totalAmountCredit += $item->amountCredit; 
						
	?>
	<tr rowIndex="<?php echo $i; ?>">
		<?php echo CHtml::activeHiddenField($item,"[$i]id"); ?>	
		<?php // echo CHtml::activeHiddenField($item,"[$i]cashReceiptJournalId"); ?>	
		<?php // echo CHtml::activeHiddenField($item,"[$i]glTransactionId"); ?>	
		<td><a class="btn-sm btn btn-primary" href="javascript:void(0);"><i class="btn-deleterowcashreceiptjournalitem glyphicon glyphicon-remove"></i></a></td>	
		<td><?php echo CHtml::dropDownList(CHtml::activeName($item,"[$i]glId"), $item->glId, CHtml::listData(Gl::getDropdownList('treeLevel < 3'), 'id', 'title'),array('class'=>'form-control')); ?></td>	
		<td><?php echo CHtml::activeTextField($item,"[$i]narration",array('class'=>'form-control')); ?></td>	
		<td><?php echo CHtml::activeTextField($item,"[$i]amountDebit",array('class'=>'form-control text-right CashReceiptJournalItemForm_amountDebit')); ?></td>	
		<td><?php echo CHtml::activeTextField($item,"[$i]amountCredit",array('class'=>'form-control text-right CashReceiptJournalItemForm_amountCredit')); ?></td>	
	</tr>
	<?php endforeach; ?>
	<tr>
		<td colspan="3" ><b>Total</b></td>	
		<td class="text-right"><b><span id="totalAmountDebit"><?php echo Yii::app()->format->formatNumber($totalAmountDebit); ?></span></b></td>	
		<td class="text-right"><b><span id="totalAmountCredit"><?php echo Yii::app()->format->formatNumber($totalAmountCredit); ?></span></b></td>	
	</tr>
<tbody>
</table>